<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org" >

<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../static/js/index.js"></script>
</head>

<script type="text/javascript" th:src="@{/js/jquery-2.1.4.min.js}"></script>
<script type="text/javascript" th:src="@{/js/bootstrap-3.3.7-dist/js/bootstrap.min.js}"></script>
<link type="text/css" rel="stylesheet" th:href="@{/js/bootstrap-3.3.7-dist/css/bootstrap.min.css}">
<script type="text/javascript" th:src="@{/js/bootstrap-treeview/bootstrap-treeview.min.js}"></script>
<link type="text/css" rel="stylesheet" th:href="@{/js/bootstrap-treeview/bootstrap-treeview.min.css}">
<script type="text/javascript" th:src="@{/js/bootStrap-addTabs/bootstrap.addtabs.min.js}"></script>
<link type="text/css" rel="stylesheet" th:href="@{/js/bootStrap-addTabs/bootstrap.addtabs.css}">
<script type="text/javascript" th:src="@{/js/bootstrap-table/bootstrap-table.min.js}"></script>
<script type="text/javascript" th:src="@{/js/bootstrap-table/locale/bootstrap-table-zh-CN.min.js}"></script>
<link type="text/css" rel="stylesheet" th:href="@{/js/bootstrap-table/bootstrap-table.min.css}">

<script type="text/javascript" th:src="@{/js/bootstrap-fileinput/js/fileinput.min.js}"></script>
<script th:src="@{/js/bootstrap-fileinput/js/locales/zh.js}"></script>


<!--登录样式 -->
<link type="text/css" rel="stylesheet" th:href="@{/js/css/font-awesome-4.7.0/css/font-awesome.min.css}">
<link type="text/css" rel="stylesheet" th:href="@{/js/css/style.css}">
<script  type="text/javascript" th:src="@{js/index.js}"></script>
<body>
<form id="myForm">
    <div class="materialContainer">
        <div class="box">
            <div class="title">登录</div>
            <div class="input">
                <label for="name">用户名</label>
                <input type="text" name="user_name" id="name">
                <span class="spin"></span>
            </div>
            <div class="input">
                <label for="pass">密码</label>
                <input type="password" name="user_password" id="pass">
                <span class="spin"></span>
            </div>
            <div class="button login">
                <button type="button" onclick="login()">
                    <span>登录</span>
                    <i class="fa fa-check"></i>
                </button>
            </div><br>
            <a href="javascript:" class="pass-forgot">忘记密码？</a>
        </div>

    </div>
</form>
</body>
<script type="text/javascript">

    function login(){
        $.ajax({
            url:"login",
            type:"post",
            data:$("#myForm").serialize(),
            success:function(data){
                console.log(data)
                alert(data.message)
                if(data.code==200){
                    location.href="index.html"
                }
            }
        })
    }
  /*  function sub(){
        $.ajax({
            url:"addUser",
            type:"post",
            data:$("#myForm").serialize(),
            dataType:"json",
            success:function(){
                alert("注册成功")
                $('#myTable').bootstrapTable('refresh');//刷新表格
                $("#addLayer").modal('hide');
            },error:function(){
                alert("注册失败")
                $('#myTable').bootstrapTable('refresh');//刷新表格
                $("#addLayer").modal('hide'); //关闭弹窗
            }
        })
    }*/

    function shuaxin(){
        $("#img").prop("src","<%=request.getContextPath()%>/login/code.do?"+new Date().getTime());
    }

</script>
</html>